//
//  SwiftUIImage.swift
//  SwiftUICode
//
//  Created by yangkl on 2024/2/19.
//

import SwiftUI

struct SwiftUIImage: View {
    var body: some View {
        Image(systemName: "cloud.heavyrain")
            .font(.system(size: 100))
            .foregroundColor(.blue)
            .shadow(color: .gray, radius: 10, x: 0, y: 10)
    }
}

struct SwiftUIParis: View {
    var body: some View {
        Image("R-C")
            .resizable()
//            .ignoresSafeArea()
            .scaledToFit()
            .aspectRatio(contentMode: .fill)
            .frame(width: 300)
//            .clipped()
//            .clipShape(/*@START_MENU_TOKEN@*/Circle()/*@END_MENU_TOKEN@*/)
//            .clipShape(Ellipse())
            .clipShape(Capsule())
            .opacity(0.5)
            .overlay(
//                Image(systemName: "heart.fill")
//                    .font(.system(size: 80))
//                    .foregroundColor(.red)
//                    .opacity(0.8)
                // 多行文字的处理
                Text("Your time is limited, so don’t waste it living someone else’s life. Don’t be trapped by dogma—which is living with the results of other people’s thinking. Don’t let the noise of others’ opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition.")
                    .fontWeight(.bold)
                    .font(.callout)
                    .foregroundColor(.white)
                //            .multilineTextAlignment(.leading)
                // 多行对齐方式
                    .multilineTextAlignment(.center)
                // 显示行数限制
                    .lineLimit(nil)
                    .background(Color.black)
                    .cornerRadius(10)
                    .padding()
                // 文字的截断模式
                    .truncationMode(.head)
                // 设置行间距
                    .lineSpacing(5),
                
                alignment: .top
                    
            )
            .shadow(color: .gray, radius: 10, x: 0, y: 4)
    }
}

#Preview {
    SwiftUIImage()
}

#Preview {
    SwiftUIParis()
}
